| Visual Basic (Declaration) | |
|---|---|
Public ReadOnly Property GetterInterceptor As PropertyInterceptor(Of TInstance,TValue,DataEntityPropertyGetInterceptorArgs(Of TInstance,TValue)) | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As DataEntityProperty(Of TInstance,TValue) Dim value As PropertyInterceptor(Of TInstance,TValue,DataEntityPropertyGetInterceptorArgs(Of TInstance,TValue)) value = instance.GetterInterceptor | |
| C# | |
|---|---|
public PropertyInterceptor<TInstance,TValue,DataEntityPropertyGetInterceptorArgs<TInstance,TValue>> GetterInterceptor {get;} | |
| C++/CLI | |
|---|---|
public: property PropertyInterceptor<TInstance^,TValue^,DataEntityPropertyGetInterceptorArgs<TInstance^,TValue^>^>^ GetterInterceptor { PropertyInterceptor<TInstance^,TValue^,DataEntityPropertyGetInterceptorArgs<TInstance^,TValue^>^>^ get(); } | |
| C# | Copy Code |
|---|---|
public void Sample() { // Add a BeforeGet action to a GetterInterceptor: Employee.PropertyMetadata.Address.GetterInterceptor.AddAction( PropertyInterceptorTiming.Before, TraceGetter); // Add a BeforeSet action to a SetterInterceptor: Employee.PropertyMetadata.Country.SetterInterceptor.AddAction( PropertyInterceptorTiming.Before, TraceSetter); // Get/set a few properties DomainModelEntityManager mgr = new DomainModelEntityManager(); Employee e = mgr.Employees.First(); string addy = e.Address; e.Country = "UK"; } public static void TraceGetter(IEntityPropertyGetInterceptorArgs args) { Console.WriteLine("getter called for " + args.EntityProperty.Name); } public static void TraceSetter(IEntityPropertySetInterceptorArgs args) { Console.WriteLine("setter called for " + args.EntityProperty.Name); } | |
Use the GetterInterceptor to add custom BeforeGet and AfterGet interception actions to a property getter.
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family